import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim_creatures, main
from util import *

# TODO: glowing blood

description = \
"""
A semi-sentient humanoid fungus that zealously guards its ancestral mycopatch.
"""

class Mycothrope(sim_creatures.Monster):
    def __init__(self):
        sim_creatures.Monster.__init__(
            self,
            'mycothrope',    # name
            parole.map.AsciiTile('F', colors['Chartreuse']), # symbol, color
            18,  # str
            5, # dex
            18,  # con
            10, # per
            5, # spd
            3,  # level
            60, # xp value
            False, # name starts with vowel? i.e., use "an" instead of "a"
            [],  # equipment slots
            'spores', # unarmed attack verb
            'die',  # death verb
            False,    # leaves corpse?
            1000, # unarmed attack energy
            description,
            bloodClass=sim_creatures.BiolumBlood,
            lightTolerance=-1,
            feelsPain=False,
        )

    def die(self, dieVerb=None, corpsePossible=False):
        pos = self.pos
        tile = self.parentTile
        super(Mycothrope, self).die(dieVerb=dieVerb, corpsePossible=False)

        # special effect: mycothropes leave a permanent cloud of glowing spores
        # when they die
        if visible(tile):
            main.transient("A large cloud of glowing spores erupts from the dead "\
                           "mycothrope, dissolving it.", tile)
        lightSource = parole.map.LightSource((0,255,0), 2.3)
        lightSource.apply(tile.map, pos)
        tile.map.update()

        if main.mapFrame.fovObj and not main.player.dead:
            main.mapFrame.touchFOV()


#========================================
thingClass = Mycothrope


